package cn.cslg.tieba.web;

import cn.cslg.tieba.domain.entity.Ba;
import cn.cslg.tieba.domain.entity.FloorWithUser;
import cn.cslg.tieba.domain.entity.Tie;
import cn.cslg.tieba.service.ReadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Wu Zhenwei
 * 2017/11/21
 */
@RestController
public class ReadController {

    @Autowired
    private ReadService readService;

    @GetMapping("/bas")
    public List<Ba> bas() {
        return readService.findBas();
    }

    @GetMapping("/ties")
    public List<Tie> findTiesByBa(Integer baId) {
        return readService.findTiesByBa(baId);
    }

    @GetMapping("/floors")
    public List<FloorWithUser> findFloorsByTie(Integer tieId) {
        return readService.findFloorsByTie(tieId);
    }
}
